From: Sergey Ponomarev Date: Sat, 1 Jun 2024 16:45:57 +0000 (+0300) Subject: luci-app-acme: show button "Install package acme-acmesh-dnsapi" if DNS mode is used X-Git-Url: http://git.openwrt.org/%22https:/collectd.org/%22http:/www.crowdsec.net//%22https%22/%22https:/collectd.org/%22http:/www.crowdsec.net/%22https%22?a=commitdiff_plain;h=170c8e5f197b9cf5bf18c3ef7184d8b3bc8406ec;p=project%2Fluci.git luci-app-acme: show button "Install package acme-acmesh-dnsapi" if DNS mode is used Signed-off-by: Sergey Ponomarev --- diff --git a/applications/luci-app-acme/htdocs/luci-static/resources/view/acme.js b/applications/luci-app-acme/htdocs/luci-static/resources/view/acme.js index 07cac56416..937a931269 100644 --- a/applications/luci-app-acme/htdocs/luci-static/resources/view/acme.js +++ b/applications/luci-app-acme/htdocs/luci-static/resources/view/acme.js @@ -18,6 +18,7 @@ return view.extend({ return certs; }), L.resolveDefault(fs.exec_direct('/usr/libexec/acmesh-dnsinfo.sh'), ''), + L.resolveDefault(fs.stat('/usr/lib/acme/client/dnsapi'), null), ]); }, @@ -25,7 +26,7 @@ return view.extend({ let certs = data[0]; let dnsApiInfoText = data[1]; let apiInfos = dnsapi.parseFile(dnsApiInfoText); - + let hasDnsApi = data[2] != null; let wikiUrl = 'https://github.com/acmesh-official/acme.sh/wiki/'; let wikiInstructionUrl = wikiUrl + 'dnsapi'; let m, s, o; @@ -78,6 +79,19 @@ return view.extend({ o.value('dns', _('DNS')); o.default = 'standalone'; + if (!hasDnsApi) { + let dnsApiPkg = 'acme-acmesh-dnsapi'; + o = s.taboption('general', form.Button, '_install'); + o.depends('validation_method', 'dns'); + o.title = _('Package is not installed'); + o.inputtitle = _('Install package %s').format(dnsApiPkg); + o.inputstyle = 'apply'; + o.onclick = function () { + let link = L.url('admin/system/package-manager') + '?query=' + dnsApiPkg; + window.open(link, '_blank', 'noopener'); + }; + } + o = s.taboption('general', form.DynamicList, "domains", _("Domain names"), _("Domain names to include in the certificate. " + "The first name will be the subject name, subsequent names will be alt names. " +